local more1__sifu = fk.CreateSkill{
  name = "more1__sifu",
}
Fk:loadTranslationTable{
  ["more1__sifu"] = "思赋",
  [":more1__sifu"] = "你无法成为其他角色使用牌的合法目标，直到首轮结束或你因“思赋”获得牌或发动“悲笳”；"..
  "出牌阶段每种点数限一次，你可以从牌堆中获得两张你指定点数的牌，然后令“悲笳”转韵，并选择一项：1.弃置其中一张牌和一张本回合非因此技能获得的牌；2.本回合此技能失效；背水：摸三张牌。",
  ["#more1__sifu-active"] = "发动 思赋，从牌堆中随机获得一张指定点数的牌",
  ["#more1__sifu-discard"] = "弃置牌",
  ["more1__sifu_choice"] = "选择点数",
  ["#more1__sifu-choose"] = "选择一项执行",
  ["more1__sifu-discard"] = "弃置牌",
  ["more1__sifu-invalidate"] = "技能失效",
  ["@@more1__sifu-inhand"] = "思赋",
  ["$more1__sifu1"] = "此心如置冰壶，无物可暖。",
  ["$more1__sifu2"] = "年少爱登楼，欲说语还休。",

}

more1__sifu:addEffect("active", {
  name = "more1__sifu",
  prompt = "#more1__sifu-active",
  anim_type = "drawcard",
  interaction = function(self, player)
    local numbers = {}
    for _, num in ipairs({"1", "2", "3", "4","5", "6", "7", "8","9", "10", "11", "12","13"}) do
      if player:getMark("more1__sifu"..num.."-turn") == 0 then
        table.insert(numbers, 1, num)
      end
    end
    return UI.ComboBox {choices = numbers}
  end,
  target_num = 0,
  card_num = 0,
  card_filter = Util.FalseFunc,
  can_use = function (self, player)
    if player:hasSkill(more1__sifu.name, true) then
      for i = 1, 13, 1 do
        if player:getMark("more1__sifu"..i.."-turn") == 0 then
          return true
        end
      end
    end
  end,
  on_use = function (self, room, effect)
    local player = effect.from
    player.room:addPlayerMark(player,"more1__sifu_damage")
    room:addPlayerMark(player,"more1__sifu"..self.interaction.data.."-turn",1)
    local cards = room:getCardsFromPileByRule(".|" .. self.interaction.data,2)
    if #cards > 0 then
      room:obtainCard(player, cards, true, fk.ReasonPrey, player, more1__sifu.name,"@@more1__sifu-inhand")
    end
    local choice = room:askToChoices(player, {
      choices = {"more1__sifu-discard","more1__sifu-invalidate","beishui"},
      min_num = 1,
      max_num = 1,
      skill_name = more1__sifu.name,
      prompt = "#more1__sifu-choose",
      cancelable = false,
    })
    if choice[1] == "more1__sifu-discard" then 
      local card = room:askToChooseCard(player, {
        min_num = 1,
        max_num = 1,
        target = player,
        flag = { card_data = {{ more1__sifu.name, cards }} },
        skill_name = more1__sifu.name,
        prompt = "#more1__sifu-discard",
      })
      room:throwCard(card, more1__sifu.name, player, player)
      local oldcards = table.filter(player:getCardIds("h"),function(p) return Fk:getCardById(p):getMark("@@more1__sifu-inhand") == 0
        
      end)
      local card = room:askToChooseCard(player, {
        min_num = 1,
        max_num = 1,
        target = player,
        flag = { card_data = {{ more1__sifu.name, oldcards }} },
        skill_name = more1__sifu.name,
        prompt = "#more1__sifu-discard",
      })
      room:throwCard(card, more1__sifu.name, player, player)
    elseif choice[1] == "more1__sifu-invalidate" then
      room:invalidateSkill(player, more1__sifu.name, "-turn")
    elseif choice[1] == "beishui" then
      local card = room:askToChooseCard(player, {
        min_num = 1,
        max_num = 1,
        target = player,
        flag = { card_data = {{ more1__sifu.name, cards }} },
        skill_name = more1__sifu.name,
        prompt = "#more1__sifu-discard",
      })
      room:throwCard(card, more1__sifu.name, player, player)
      local oldcards = table.filter(player:getCardIds("h"),function(p) return Fk:getCardById(p):getMark("@@more1__sifu-inhand") == 0
      end)
      local card = room:askToChooseCard(player, {
        min_num = 1,
        max_num = 1,
        target = player,
        flag = { card_data = {{ more1__sifu.name, oldcards }} },
        skill_name = more1__sifu.name,
        prompt = "#more1__sifu-discard",
      })
      room:throwCard(card, more1__sifu.name, player, player)
      room:invalidateSkill(player, more1__sifu.name, "-turn")
      room:drawCards(player,3,more1__sifu.name)
    end

  end,
})

more1__sifu:addEffect("prohibit", {
  is_prohibited = function(self, from, to, card)
    return to:hasSkill(more1__sifu.name) and card and to:getMark("more1__sifu_damage") == 0
  end,
})

more1__sifu:addEffect(fk.RoundEnd, {
  mute = true,
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(more1__sifu.name)
  end,
  on_use = function(self, event, target, player, data)
    player.room:addPlayerMark(player,"more1__sifu_damage")
  end,
})















return more1__sifu